package com.lpx.demo.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {
    /**
     * 首页 欢迎页
     *
     * @return
     */
    @RequestMapping("/")
    public String index() {
        return "/index/index";
    }

    @RequestMapping("index/websocket/{name}")
    public String webSocket(@PathVariable String name, Model model) {
        try {
            model.addAttribute("username", name);
            return "index/textonline";
        } catch (Exception e) {
            return "error";
        }
    }

    }
